<script>
    $().ready(function(){
        $('.txt_active2').change(function(){
            var active = $(this).val();
             var id = $(this).attr('id');             
             $.ajax({
                type : "GET",
                dataType : "json",
                url : "<?php echo base_url().'admin/page/change_update_active'?>",
                data : 'id=' + id + '&active=' + active,
                success : function(result){
                    alert(result.error);
                    return false;
                }
            });
        });        
    });
</script>
<div class="info">
<h1 class="font_h1">Danh sách trang</h1>
<?php if(isset($error))  : ?>
<h2 class="error_red"><?php echo $error;?></h2>
<?php endif;?>
<table cellpadding="0" cellspacing="0" style="background:#FFF; color:#000; ">
        <tr class="tr">
        	<td><input type="checkbox" value=""></td>        	
            <td>Tên trang</td>             
            <td>Sắp xếp</td>
            <td>Kích hoạt</td>           
            <td colspan="2">Hành động</td>            
        </tr>
        <?php foreach($pages as $row):?>
        <tr style="text-align:center">
        	<td><input type="checkbox" value=""></td>   
        	<td><?php echo $row->heading;?></td>
            <td><?php echo $row->order_page;?></td>
            <td>
             <select class="txt_active2" id="<?php echo $row->id_page;?>" style="width:120px">
            	<option value="1"<?php if($row->active == '1') echo "selected";?>>Hiển thị</option>
                <option value="0"<?php if($row->active == '0') echo "selected";?>>Không hiện thị</option>
            </select>
            </td>
            <td>
            	<a href="<?php echo base_url().'admin/page/add/'.$row->id_page?>" title="Edit"><img src="<?php echo base_url()?>public/admin/images/user_edit.png"></a>
            </td>
        </tr>
        <?php endforeach; ?>
      
        

</table>
</form>
<a href="<?php echo base_url()?>admin/page/user_add" class="button">Xóa bản tin đã chọn</a>
<a href="<?php echo base_url()?>admin/page/add" class="button">Tạo mới</a>

</div>